package com.yeren.czbk.basic.dao;

import static org.junit.Assert.*;

import java.util.List;

import org.junit.Test;

import com.yeren.czbk.basic.dao.impl.TuserDaoImpl;
import com.yeren.czbk.basic.entity.Tuser;
import com.yeren.czbk.util.QueryRusult;

public class TtuserDaoTest {
	private TuserDaoImpl tuserDaoImpl = new TuserDaoImpl();

	 @Test
	public void testSave() {
		Tuser user = new Tuser();
		user.setName("AA");
		user.setAccount("AA");
		user.setPassword("AA");
		user.setAge(5);

		tuserDaoImpl.save(user);
	}

	 @Test
	public void testDelete() {
		tuserDaoImpl.delete(2);
	}

	 @Test
	public void testUpdate() {
		Tuser user = tuserDaoImpl.getById(1);
		user.setName("sb");
		tuserDaoImpl.update(user);
	}

	 @Test
	public void testGetById() {
		Tuser user = tuserDaoImpl.getById(1);
		System.out.println(user.getAge());
	}

	 @Test
	public void testFindAll() {
		List<Tuser> list = tuserDaoImpl.findAll();
		for (Tuser u : list) {
			System.out.println(u.getAccount());
		}
	}

	 @Test
	public void testFindAllIntegerInteger() {
		QueryRusult qr = tuserDaoImpl.findAll(0, 2);
		for (Tuser user : (List<Tuser>) qr.getList()) {
			System.out.println(user.getAccount());
		}
	}

}
